// 手写防抖（简单版本）
const debounce = (fn, timer) => {
  let timeOut;
  return () => {
    clearTimeout(timeOut);
    timeOut = setTimeout(fn, timer);
  };
};

// 手写防抖（进阶）

const testFn = () => {
  console.log(123);
};

const debounceFn1 = debounce(testFn, 300);

debounceFn1();
debounceFn1();
debounceFn1();
